from django.contrib import admin
from blog.models import Post
from bookmarks.models import Bookmark
from photologue.models import Gallery, Photo, PhotoSize

class PostOptions(admin.ModelAdmin):
  prepopulated_options={'slug': 'title' }
  list_display = ('user', 'title', 'slug', 'pub_date', 'enable_comments')
  search_fields = ('title', 'description','tags')
  date_hierarchy = 'pub_date'
  # Adding tiny_mce into Django admin:
  # http://www.dehora.net/journal/2006/05/using_tinymce_in_djangos_admin.html
  class Media:
    js = ['js/tiny_mce/tiny_mce.js', 'js/textarea.js']

class GalleryOptions(admin.ModelAdmin):
  prepopulated_options={'slug': 'title' }
  list_display = ('title', 'pub_date', 'photo_count', 'is_public')
  list_filter = ['pub_date', 'is_public']
  date_hierarchy = 'pub_date'

class PhotoOptions(admin.ModelAdmin):
  prepopulated_options={'slug': 'title' }
  list_display = ('title', 'pub_date', 'admin_thumbnail','is_public')
  list_filter = ['pub_date', 'is_public']
  list_per_page = 10

class PhotoSizeOptions(admin.ModelAdmin):
  list_display = ('name', 'width', 'height', 'crop')
  

admin.site.register(Post, PostOptions)
admin.site.register(Bookmark)
admin.site.register(Photo, PhotoOptions)
admin.site.register(PhotoSize, PhotoSizeOptions)
admin.site.register(Gallery, GalleryOptions)

